If the horizontal adjustment changes because of a change in the layout
authorAnders Carlsson <andersca@imendio.com>
Wed, 18 May 2005 17:10:46 +0000 (17:10 +0000)
committerAnders Carlsson <andersca@src.gnome.org>
Wed, 18 May 2005 17:10:46 +0000 (17:10 +0000)
2005-05-18  Anders Carlsson  <andersca@imendio.com>

* gtk/gtktextview.c: (gtk_text_view_flush_scroll),
(gtk_text_view_update_adjustments), (gtk_text_view_value_changed):
* gtk/gtktextview.h:
If the horizontal adjustment changes because of a change in the
layout width, then do a complete redraw. This is because there
might be right-aligned or centered text that needs to be redrawn.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtktextview.c
gtk/gtktextview.h

index e32ee7944d7c1e5466e9bf37b41065e1e1279b81..7ae8e6d8b301f4608c2f929d5c6894379ad25bde 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-05-18  Anders Carlsson  <andersca@imendio.com>
+
+       * gtk/gtktextview.c: (gtk_text_view_flush_scroll),
+       (gtk_text_view_update_adjustments), (gtk_text_view_value_changed):
+       * gtk/gtktextview.h:
+       If the horizontal adjustment changes because of a change in the
+       layout width, then do a complete redraw. This is because there
+       might be right-aligned or centered text that needs to be redrawn.
+       
 2005-05-18  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_add_events): Try harder to set
index e32ee7944d7c1e5466e9bf37b41065e1e1279b81..7ae8e6d8b301f4608c2f929d5c6894379ad25bde 100644 (file)
@@ -1,3 +1,12 @@
+2005-05-18  Anders Carlsson  <andersca@imendio.com>
+
+       * gtk/gtktextview.c: (gtk_text_view_flush_scroll),
+       (gtk_text_view_update_adjustments), (gtk_text_view_value_changed):
+       * gtk/gtktextview.h:
+       If the horizontal adjustment changes because of a change in the
+       layout width, then do a complete redraw. This is because there
+       might be right-aligned or centered text that needs to be redrawn.
+       
 2005-05-18  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_add_events): Try harder to set
index e32ee7944d7c1e5466e9bf37b41065e1e1279b81..7ae8e6d8b301f4608c2f929d5c6894379ad25bde 100644 (file)
@@ -1,3 +1,12 @@
+2005-05-18  Anders Carlsson  <andersca@imendio.com>
+
+       * gtk/gtktextview.c: (gtk_text_view_flush_scroll),
+       (gtk_text_view_update_adjustments), (gtk_text_view_value_changed):
+       * gtk/gtktextview.h:
+       If the horizontal adjustment changes because of a change in the
+       layout width, then do a complete redraw. This is because there
+       might be right-aligned or centered text that needs to be redrawn.
+       
 2005-05-18  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_add_events): Try harder to set
index 668dd4e12f52f8363af5d012a6847e0ae95fc9ce..d207cf68101f1c1b14abc56243d2047a26396e0c 100644 (file)
@@ -1728,7 +1728,7 @@ gtk_text_view_flush_scroll (GtkTextView *text_view)
                                          scroll->use_align,
                                          scroll->xalign,
                                          scroll->yalign);
-  
+
   free_pending_scroll (scroll);
 
   return retval;
@@ -1776,6 +1776,9 @@ gtk_text_view_update_adjustments (GtkTextView *text_view)
 
   if (text_view->width != width || text_view->height != height)
     {
+      if (text_view->width != width)
+       text_view->width_changed = TRUE;
+
       text_view->width = width;
       text_view->height = height;
 
@@ -6489,6 +6492,17 @@ gtk_text_view_value_changed (GtkAdjustment *adj,
     {
       dx = text_view->xoffset - (gint)adj->value;
       text_view->xoffset = adj->value;
+
+      /* If the change is due to a size change we need 
+       * to invalidate the entire text window because there might be
+       * right-aligned or centered text 
+       */
+      if (text_view->width_changed)
+       {
+         gdk_window_invalidate_rect (text_view->text_window->bin_window, NULL, FALSE);
+         
+         text_view->width_changed = FALSE;
+       }
     }
   else if (adj == text_view->vadjustment)
     {
index ff3a67c800f73372359efd371bd67fe27ffe6c86..90629353308052f05ec59d9e18a135895ae23078 100644 (file)
@@ -93,8 +93,7 @@ struct _GtkTextView
 
   guint accepts_tab : 1;
   
-  /* this flag is no longer used */
-  guint reserved : 1;
+  guint width_changed : 1;
   
   /* debug flag - means that we've validated onscreen since the
    * last "invalidate" signal from the layout
@@ -102,7 +101,7 @@ struct _GtkTextView
   guint onscreen_validated : 1;
 
   guint mouse_cursor_obscured : 1;
-  
+
   GtkTextWindow *text_window;
   GtkTextWindow *left_window;
   GtkTextWindow *right_window;